<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据统计 - 喝水记录小管家</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="styles.css">
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
    <div class="iphone-frame">
        <div class="status-bar">
            <div>9:41</div>
            <div>
                <i class="fas fa-signal"></i>
                <i class="fas fa-wifi ml-1"></i>
                <i class="fas fa-battery-full ml-1"></i>
            </div>
        </div>
        
        <div class="content">
            <div class="flex justify-between items-center mb-6">
                <h1 class="text-2xl font-bold">数据统计</h1>
            </div>
            
            <div class="segment-control">
                <div class="segment-item active">日</div>
                <div class="segment-item">周</div>
                <div class="segment-item">月</div>
            </div>
            
            <div class="card">
                <div class="flex justify-between items-center mb-4">
                    <h2 class="text-xl font-semibold">饮水趋势</h2>
                    <div class="text-sm text-gray-500">10月9日-10月15日</div>
                </div>
                
                <canvas id="waterChart" class="chart-container"></canvas>
                
                <script>
                    const ctx = document.getElementById('waterChart').getContext('2d');
                    const waterChart = new Chart(ctx, {
                        type: 'bar',
                        data: {
                            labels: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
                            datasets: [{
                                label: '饮水量 (ml)',
                                data: [1800, 2100, 1950, 2300, 1700, 2000, 1400],
                                backgroundColor: '#007aff',
                                borderRadius: 8
                            }]
                        },
                        options: {
                            responsive: true,
                            plugins: {
                                legend: {
                                    display: false
                                }
                            },
                            scales: {
                                y: {
                                    beginAtZero: true,
                                    grid: {
                                        display: false
                                    }
                                },
                                x: {
                                    grid: {
                                        display: false
                                    }
                                }
                            }
                        }
                    });
                </script>
            </div>
            
            <div class="grid grid-cols-2 gap-4 mt-6">
                <div class="card">
                    <h3 class="text-lg font-semibold mb-2">平均饮水量</h3>
                    <div class="text-3xl font-bold text-blue-500">1893<span class="text-xl">ml</span></div>
                    <div class="text-sm text-gray-500 mt-1">本周</div>
                </div>
                
                <div class="card">
                    <h3 class="text-lg font-semibold mb-2">达标天数</h3>
                    <div class="text-3xl font-bold text-green-500">5<span class="text-xl">天</span></div>
                    <div class="text-sm text-gray-500 mt-1">本周</div>
                </div>
            </div>
            
            <div class="card mt-6">
                <h2 class="text-xl font-semibold mb-4">饮水类型分布</h2>
                
                <canvas id="typeChart" class="chart-container"></canvas>
                
                <script>
                    const typeCtx = document.getElementById('typeChart').getContext('2d');
                    const typeChart = new Chart(typeCtx, {
                        type: 'doughnut',
                        data: {
                            labels: ['白开水', '绿茶', '咖啡', '其他'],
                            datasets: [{
                                data: [65, 15, 12, 8],
                                backgroundColor: [
                                    '#007aff',
                                    '#4cd964',
                                    '#ff9500',
                                    '#ff3b30'
                                ],
                                borderWidth: 0
                            }]
                        },
                        options: {
                            responsive: true,
                            plugins: {
                                legend: {
                                    position: 'bottom'
                                }
                            },
                            cutout: '70%'
                        }
                    });
                </script>
            </div>
            
            <div class="card mt-6">
                <h2 class="text-xl font-semibold mb-4">健康建议</h2>
                
                <div class="bg-blue-50 p-4 rounded-lg">
                    <div class="flex items-start">
                        <i class="fas fa-lightbulb text-blue-500 mt-1 mr-3"></i>
                        <div>
                            <div class="font-semibold mb-1">保持良好势头</div>
                            <div class="text-sm text-gray-600">您本周的饮水情况良好，建议继续保持。早晨起床后喝一杯温水，有助于促进新陈代谢。</div>
                        </div>
                    </div>
                </div>
                
                <div class="bg-yellow-50 p-4 rounded-lg mt-3">
                    <div class="flex items-start">
                        <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-3"></i>
                        <div>
                            <div class="font-semibold mb-1">注意咖啡摄入</div>
                            <div class="text-sm text-gray-600">您的咖啡摄入量略高，咖啡虽然可以计入液体摄入，但过多会导致利尿作用，建议适量饮用。</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="tab-bar">
            <div class="tab-item">
                <i class="fas fa-home tab-icon"></i>
                <span>首页</span>
            </div>
            <div class="tab-item">
                <i class="fas fa-plus-circle tab-icon"></i>
                <span>记录</span>
            </div>
            <div class="tab-item active">
                <i class="fas fa-chart-line tab-icon"></i>
                <span>统计</span>
            </div>
            <div class="tab-item">
                <i class="fas fa-users tab-icon"></i>
                <span>社交</span>
            </div>
            <div class="tab-item">
                <i class="fas fa-user tab-icon"></i>
                <span>我的</span>
            </div>
        </div>
    </div>
</body>
</html>